﻿#region License statement
// NJamb, a specification and delta-specification DSL
// Copyright (c) 2010-2011, Mark Knell
// Published under the MIT License; all other rights reserved
#endregion

#region using...
using System;
using System.Collections.Generic;
using NJamb.NUnit;
using NJamb.Parser.SpecificationBuilders.SubjectIs.Simple.Enumerable;
using NJamb.Parser.SubjectBuilders;
using NJamb.Specifications.Simple.Enumerable;
using NUnit.Framework;
using Stile.Patterns.SelfDescribingPredicates;
#endregion

namespace NJamb.Tests.Parser.SpecificationBuilders.SubjectIs.Simple.Enumerable
{
    [TestFixture]
    public class EnumerableIsExtensionsFixture : EvaluatingSampleFixture
    {
        [Test]
        public void ReadOnly()
        {
            Assert.That(_sample.IntCollection.IsReadOnly, Is.False);

            // arrange
            IEnumerableSpecification<ICollection<int>, int> specification =
                Specify.For(() => _sample).ThatTheCollection(x => x.IntCollection).Is.ReadOnly();

            // act
            IEvaluation<ICollection<int>> evaluation = specification.Evaluate();

            // assert
            AssertEvaluationFailed(evaluation,
                "expected _sample.IntCollection would be a read only collection" + Environment.NewLine + " but was mutable.");
        }
    }
}
